package leetcode.d1;

import java.util.Arrays;

/**
 * @Author: hang an
 * @Date: 2025/5/15
 * @Description:
 */
public class R3545 {
    public int minDeletion(String s, int k) {
        int[] cnt = new int[26];
        char[] charArray = s.toCharArray();
        for (char c : charArray) {
            cnt[c - 'a']++;
        }
        int res = 0;
        Arrays.sort(cnt);
        int end = 26 - k;
        for (int i = 0; i < end;i++) {
            res +=  cnt[i];
        }
        return res;

    }

}
